package com.example.consult.mapper;

import com.example.consult.model.Suggestion;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SuggestionMapper {
    /*
    插入
     */
    @Insert("insert into suggestion(title,content,user_account) value(#{title},#{content},#{user_account}) ")
    public int insert(Suggestion suggestion);
    /*
    修改状态
     */
    @Update("update suggestion set state=#{state}")
    public int update(int state);
    /*
    查询状态为0未解决的建议
     */
    @Select("select * from suggestion where state=${0}")
    public List<Suggestion> selectAllSuggestionFor0();
    @Select("select * from suggestion where state=${1}")
    public List<Suggestion> selectAllSuggestionFor1();
}
